<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"/>
<title></title>
<script src="script/xlv.js"></script>
</head>
<body> 
<div xlvobject="xlv.obj.borderLayout">
	<div id="xlvid_north">
		<div style="background: url('/xlive/images/probeweb/background_active.gif')">
			<img src="/xlive/images/probeweb/probe_logo.gif"/>
			<span style="color:white;font-size:24pt">probe Technologies</span>
		</div>
	</div>
	<div id="xlvid_center" style="vertical-align:top;background:url(/xlive/images/blueTexture.gif);padding:4px;">
	
		<div xlvobject="xlv.obj.webObject" 
		     xlvprop="{name:'tomcat.directory',objectURL:'fs.tomcat', methodName:'list',currentNodeSustain:'position',webObjectProperties:{list:{'file-or-directory-only':'directory'}} }">
		</div>
		
		<div xlvobject="xlv.obj.rowset" 
		     xlvprop="{name:'tomcat.file',objectURL:'fs.tomcat', methodName:'list',
					  			dataXPath:'properties.list.return.root',rowName:'file',
					  			webObjectProperties:{list:{'file-or-directory-only':'file'}} }">
		</div>
		<div xlvobject="xlv.obj.dmTrigger" 
		     xlvprop="{dmName:'tomcat.directory',listener:{when:'afterModelChanged',notify:'cursorMove'},
								  dmTargetName:'tomcat.file',methodName:'webMethod',options:'list'}"
			 xlvmethod="{
						valueMap:function(){
						var dm=this.mvc_getModel();
						var dm_target=this.mvc_getModel(this.$P.dmTargetName);
						var current=dm.$V.currentNode;
						var name='';
						while(current){
							if(current.nodeName=='root')break;
							name=current.getAttribute('name')+((name=='')?'':'/')+name;
							current=current.parentNode;
						}
						dm_target.setValue(name,'properties.list.name');
						}}">
		</div>
		<div style="position:relative;right:0px;left:0px;z-index:100;padding:12px">
			<div xlvobject="xlv.obj.dmProcess" style="float:left"
			     xlvprop="{
				  	  	title:'rename',dmName:'tomcat.directory',
					  	methodName:'webMethod',options:'rename',
					  	srcImg:'/xlive/images/favorites.png'}"
				 xlvmethod="{
						valueMap:function(){
							var dm=this.mvc_getModel();
							var current=dm.$V.currentNode.parentNode;
							var name='';
							while(current){
								if(current.nodeName=='root')break;
									name=current.getAttribute('name')+((name=='')?'':'/')+name;
									current=current.parentNode;
								}
							dm.setValue(name,'properties.rename.work-directory');
							dm.setValue(name,'properties.rename.to-work-directory');
						 },
					  	 process:function(){
							var dm=this.mvc_getModel();
							if(dm){
								var name=dm.getValue('./@name');
								var toname=prompt('rename the directory : '+name+'\nnew directory name : ',name);
								if(toname!=null&&toname!=name&&toname.strip().length>0){
									dm.setValue(name,'properties.rename.name');
									dm.setValue(toname,'properties.rename.to-name');
									this.$self('process');
								}
							}
						 },
						 mvc_afterModelChanged:function(dm,notify,memo){
							if(notify=='setChanged'&&dm.$V.lastMethodName=='rename'){
								var ret=dm.getValue('properties.rename.return.valid');
								if('true'==ret) dm.setValue(dm.getValue('properties.rename.to-name'),'./@name');
								else alert('rename failure : '+dm.getValue('properties.rename.return.why'));
								this.mvc_enableControl(dm);
							}
						 }
					}">
			</div>
			<div xlvobject="xlv.obj.dmProcess" style="float:left"
				 xlvprop="{
					  	title:'make',dmName:'tomcat.directory',
					  	methodName:'webMethod',options:'md',
					  	srcImg:'/xlive/images/tab_add.png',
					  	srcImgHover:'/xlive/images/tab_add.png'}"
				 xlvmethod="{
						valueMap:function(){
							var dm=this.mvc_getModel();
							var current=dm.$V.currentNode;
							var name='';
							while(current){
								if(current.nodeName=='root')break;
									name=current.getAttribute('name')+((name=='')?'':'/')+name;
				 					current=current.parentNode;
								}
							dm.setValue(name,'properties.md.work-directory');
						},
						process:function(){
							var dm=this.mvc_getModel();
							if(dm){
								var name=prompt('make directory : \ninput name : ');
								if(name!=null&&name.strip().length>0){
									dm.setValue(name,'properties.md.name');
									this.$self('process');
								}
							}
						},
						mvc_afterModelChanged:function(dm,notify,memo){
							if(notify=='setChanged'&&dm.$V.lastMethodName=='md'){
								var ret=dm.getValue('properties.md.return.valid');
								if('true'==ret) dm.webMethod('list');
								else alert('make directory failure : '+dm.getValue('properties.md.return.why'));
								this.mvc_enableControl(dm);
							}
					}}">
			</div>
			<div xlvobject="xlv.obj.dmProcess" style="float:left"
				 xlvprop="{
				  	title:'remove',dmName:'tomcat.directory',
				  	methodName:'webMethod',options:'rd',
				  	srcImg:'/xlive/images/tab_close.png'}"
				 xlvmethod="{
					valueMap:function(){
						var dm=this.mvc_getModel();
						var current=dm.$V.currentNode.parentNode;
						var name='';
						while(current){
							if(current.nodeName=='root')break;
								name=current.getAttribute('name')+((name=='')?'':'/')+name;
								current=current.parentNode;
						}
						dm.setValue(name,'properties.rd.work-directory');
					},
					process:function(){
						var dm=this.mvc_getModel();
						if(dm){
							var name=dm.$V.currentNode.getAttribute('name');
							if(confirm('remove directory : '+name)){
								dm.setValue(name,'properties.rd.name');
								this.$self('process');
							}
						}
					},
					mvc_afterModelChanged:function(dm,notify,memo){
						if(notify=='setChanged'&&dm.$V.lastMethodName=='rd'){
							var ret=dm.getValue('properties.rd.return.valid');
							if('true'==ret) dm.webMethod('list');
							else alert('remove directory failure : '+dm.getValue('properties.rd.return.why'));
							this.mvc_enableControl(dm);
						}
				}}">
			</div>
			<div xlvobject="xlv.obj.downloader" style="float:right" 
				 xlvprop="{
				  	title:'download',dmName:'tomcat.file',methodName:'properties.download',
					valueMap:{'@name':'properties.download.name','properties.list.name':'properties.download.work-directory'},
					srcImg:'/xlive/images/em_down.png'
				 }" >
			</div>
			<div xlvobject="xlv.obj.dmProcess" style="float:right"
				 xlvprop="{
					title:'delete',dmName:'tomcat.file',
					methodName:'webMethod',options:'del',
					valueMap:{'@name':'properties.del.name','properties.list.name':'properties.del.work-directory'},
					srcImg:'/xlive/images/delete.png'}"
				 xlvmethod="{
				  	process:function(){
				  		var dm=this.mvc_getModel();
				  		if(dm){
				  			var name=dm.getValue('@name');
				  			if(confirm('delete the file : '+name)) this.$self('process');
				  		}
				  	},
				  	mvc_afterModelChanged:function(dm,notify,memo){
				  		if(notify=='setChanged'&&dm.$V.lastMethodName=='del'){
				 			var ret=dm.getValue('properties.del.return.valid');
				  			if('true'==ret) dm.removePost();
				  			else alert('delete file failure : '+dm.getValue('properties.del.return.why'));
						}
						this.mvc_enableControl(dm);
					}}">
			</div>
			<div xlvobject="xlv.obj.dmProcess" style="float:right"
			     xlvprop="{
					title:'rename',dmName:'tomcat.file',
					methodName:'webMethod',options:'rename',
					valueMap:{'@name':'properties.rename.name',
						'properties.list.name':'properties.rename.work-directory',
						'properties.rename.work-directory':'properties.rename.to-work-directory'},
						srcImg:'/xlive/images/edit.png'}"
				 xlvmethod="{
				  	process:function(){
				  		var dm=this.mvc_getModel();
				  		if(dm){
				  			var name=dm.getValue('@name');
				  			var toname=prompt('rename the file : '+name+'\nnew file name : ',name);
				  			if(toname!=null&&toname!=name&&toname.strip().length>0){
				  				dm.setValue(toname,'properties.rename.to-name')
				  				this.$self('process');
				  			}
				  		}
				  	},
					mvc_afterModelChanged:function(dm,notify,memo){
						if(notify=='setChanged'&&dm.$V.lastMethodName=='rename'){
							var ret=dm.getValue('properties.rename.return.valid');
							if('true'==ret) {
								var name=dm.getValue('properties.rename.to-name');
								dm.setValue(name,'./@name');
							}
							else alert('rename failure : '+dm.getValue('properties.rename.return.why'));
						}
						this.mvc_enableControl(dm);
				}}">
			</div>
			
			<div xlvobject="xlv.obj.processPane" class="class_processPane" style="float:right"
				 xlvprop="{title:'upload',dmName:'tomcat.file',srcImg:'/xlive/images/em_up.png'}"
				 >
				<div  xlvobject="xlv.obj.pane" xlvprop="{glow:{enable:true},border:{enable:true}}"
					 xlvmethod="{
						styleFor:function(root){
							root.style.background='url(/xlive/images/lightgrayTexture.gif) left top repeat';
						}
					}"				
				>
					<div xlvobject="xlv.obj.uploader" class="class_upload" style="padding:12px"
				    	 xlvprop="{
				     		dmName:'tomcat.file',methodName:'properties.upload',
				     		valueMap:{'properties.list.name':'properties.upload.work-directory'},
				     		srcImg:'/xlive/images/_upload.png'}" 
					 	xlvmethod="{
					  		mvc_afterModelChanged:function(dm,notify,memo){
								if(notify=='setChanged'&&dm.$V.lastMethodName=='upload'){
					  				var ret=dm.getValue('properties.upload.return.valid');
									this.cleanUploadList();
									if('true'==ret) dm.webMethod('list');
									else alert('upload failure : '+dm.getValue('properties.upload.return.why'));
								}
								this.mvc_enableControl(dm);
							}}">
					</div>
			 	</div>
			 </div>	
			 		
		</div>
		<div xlvobject="xlv.obj.split" class="class_split" style="width:800px;height:500px;background:url(/xlive/images/grayTexture.gif)">
			<div id="xlvid_split_pane">
				<div  xlvobject="xlv.obj.tree" class="class_tree" xlvprop="{dmName:'tomcat.directory',dmPath:'list.return.root',editable:false,handleLine:true,nodeAttributeName:'name',leafAttributeName:'name'}"></div>
				</div>
			<div id="xlvid_split_vert"></div>
			<div id="xlvid_split_pane">
				<div xlvobject="xlv.obj.table" 
		   			 xlvprop="{dmName:'tomcat.file',tableLayout:'fixed',
								columns:[
								{title:'name',dmPath:'@name'},
								{title:'size',dmPath:'@length'},
								{title:'date',dmPath:'@lastModified'}
								],
								editable:false,rowSize:500}"  
				 	xlvmethod="{
							styleForHeader:function(cell_no,cell){
								if(cell_no==2)cell.style.width='70px';
								if(cell_no==3)cell.style.width='120px';
							},
							styleForCell:function(row_no,cell_no,cell){
								if(cell_no==2) {
									cell.style.textAlign='right';
									cell.style.fontSize='smaller';
									cell.style.paddingRight='8px';
								}
								if(cell_no==3) {
									cell.style.whiteSpace='nowrap';
									cell.style.fontSize='smaller';
								}
							}
					}">
			 	</div>
			 </div>
	  	   </div>
		</div>
	</div>
</body>
</html>
